let mongoose = require("mongoose");
mongoose.connect("mongodb://localhost:27017/newQY", {
    useNewUrlParser: true,
    useUnifiedTopology: true
}).then(() => {
    console.log("聊天-集合连接成功！");
}).catch(() => {
    console.log("集合 - 集合连接失败！");
})
let schema = mongoose.Schema;
let msglist = new schema({
    id:{
        type:String,
        required:true
    },
    user:{
        type:String,
        required:true
    },
    userName:{
        type:String,
        required:true
    },
    userImage:{
        type:String,
        required:true
    },
    message:{
        type:String,
        required:true
    },
    toUser:{
        type:String,
        required:true,
        default:""
    },
    createTime:{
        type:String,
        required:true,
    },
    type:{
        type:String,
        required:true,
        default:"all"
    }
})
let message = mongoose.model("msglist",msglist)
module.exports = {
    message
}